package org.example.Dao;

import org.apache.ibatis.annotations.*;
import org.example.JavaBean.Emp;

import java.util.List;

/**
 * @Auther:Liu
 * @Testname:EmpDao
 * @Date:2025/7/29 15:07
 */
@Mapper
public interface EmpDao {

    //    查询所有
    @Select("select * from emp where state=1")
    public List<Emp> findAll();

    //模糊查询
    @Select("Select  * from emp where state=1 and ename like #{ename}")
    public List<Emp> findByEname(String ename);

    //多表联查
    public List<Emp> find();

    //    增加数据
    @Insert("Insert into emp values (null,#{ename},#{job},#{mgr},now(),#{sal},#{comm},#{deptno},1)")
    public int insert(Emp emp);

    //    删除数据
    @Delete("Delete from emp where state=1 and empno=#{empno}")
    int delete(Integer empno);

    //    更新数据
    @Update("Update EMP Set ename=#{ename},job=#{job},mgr=#{mgr},sal=#{sal},comm=#{comm},deptno=#{deptno} where empno=#{empno} ")
    int update(Emp emp);
}
